dian're'tanmao'rong'chuang'dan'bei'zhao'/*
   查询所有的产品
 */
'use strict';

const conn = require('../../libs/Conn');
const _ = require('underscore');
const paging = require('../../libs/Paging');

module.exports = async function (params) {
    let id = params.id;
    let querySql = `select id, product_name, product_img, product_detail,date_format(create_time, '%Y-%m-%d %H:%i') AS create_time  from t_product where delete_sign=0 order by product_order desc`;
    let pagingSql=paging(querySql, params)
    let rec = await conn(pagingSql.sql);
    return pagingSql.paging ? {data: rec[0], totalCount: rec[1][0].count} : {data: rec};
};